home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Library / Manuels & Misc / Assembly / AOA.ZIP / CH06 / EX6_1.IBM next >
Encoding:
Text File  |  1995-01-31  |  1011 b   |  73 lines

  1. #repetitions 2000000
  2. #unravel 100
  3.  
  4. #code    ("ABS:Sequence 1 w/positive value")
  5. %discount
  6.         mov    ax, 1        ;Our positive value
  7. %do
  8.         local    ispos
  9.  
  10.         cmp    ax, 0
  11.         jge    ispos
  12.         neg    ax
  13. ispos:
  14. #endcode
  15.  
  16. #code    ("ABS:Sequence 2 w/positive value")
  17. %discount
  18.         mov    ax, 1        ;Our positive value
  19. %do
  20.         local    ispos
  21.  
  22.         neg    ax
  23.         jns    ispos
  24.         neg    ax
  25. ispos:
  26. #endcode
  27.  
  28. #code    ("ABS:Sequence 3 w/positive value")
  29. %discount
  30.         mov    ax, 1        ;Our positive value
  31. %do
  32.         cwd
  33.         xor    ax, dx
  34.         and    dx, 1
  35.         add    ax, dx
  36. #endcode
  37.  
  38. #code    ("ABS:Sequence 1 w/negative value")
  39. %discount
  40.         mov    ax, -1        ;Our negative value
  41. %do
  42.         local    ispos
  43.  
  44.         cmp    ax, 0
  45.         jge    ispos
  46.         neg    ax
  47. ispos:
  48. #endcode
  49.  
  50. #code    ("ABS:Sequence 2 w/negative value")
  51. %discount
  52.         mov    ax, -1        ;Our negative value
  53. %do
  54.         local    ispos
  55.  
  56.         neg    ax
  57.         jns    ispos
  58.         neg    ax
  59. ispos:
  60. #endcode
  61.  
  62. #code    ("ABS:Sequence 3 w/negative value")
  63. %discount
  64.         mov    ax, -1        ;Our negative value
  65. %do
  66.         cwd
  67.         xor    ax, dx
  68.         and    dx, 1
  69.         add    ax, dx
  70. #endcode
  71.  
  72. #end
  73.